<script setup lang="ts">
import {reactive, ref, toRefs} from "vue";
import {sendOpinion} from "../api/user";
import {useLoginStore} from "../store/user";
import {showSuccessToast} from "vant"
import 'vant/es/toast/style';
const  loginStore=useLoginStore();
let {id} =toRefs(loginStore.getUserInfo())
function onClickLeft() {
  history.go(-1)
}

function send() {
    showSuccessToast('提交成功');
    opinion.opinion=""

}

const message = ref("")
const opinion = reactive(({
  userId: id.value,
  opinion: "",
  rate:""
}))


</script>
<template>
  <div class="main">
    <van-nav-bar title="意见反馈" left-text="返回" left-arrow @click-left="onClickLeft"/>

    <van-cell-group inset>
      <van-field
          v-model="opinion.opinion"
          rows="5"
          autosize
          type="textarea"
          maxlength="50"
          placeholder="请输入意见"
          show-word-limit
      />
    </van-cell-group>

    <van-rate
        v-model="opinion.rate"
        :size="25"
        color="#ffd21e"
        void-icon="star"
        void-color="#eee"
        style="margin-left: 100px"
    />

    <van-button type="primary" block @click="send">提交</van-button>

  </div>
</template>


<style scoped>
.main {
  width: 100%;
  height: 100%;
  padding: 10px;
  background-color: white;
}


</style>